package com.liaoban.app.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.liaoban.app.R;
import com.liaoban.app.api.type.PayIndex;

import java.util.List;

/**
 * Created by ybc on 2018/7/12 0012.
 * 充值
 */
public class RechargeAdapter extends BaseQuickAdapter<PayIndex.MoneyBean, BaseViewHolder> {
    private int mSelPos = -1;

    public RechargeAdapter(@Nullable List<PayIndex.MoneyBean> data) {
        super(R.layout.item_recharge, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PayIndex.MoneyBean item) {
        helper.setText(R.id.tv_virtual_money, "" + item.getMbB());
        helper.setText(R.id.tv_money, item.getMbMoney() + "");
        if (helper.getLayoutPosition() == mSelPos) {
            helper.setBackgroundColor(R.id.layout_root, mContext.getResources().getColor(R.color.btn_red));
            helper.setTextColor(R.id.tv_virtual_money, mContext.getResources().getColor(R.color.white));
            helper.setTextColor(R.id.tv_money, mContext.getResources().getColor(R.color.btn_yellow));
            helper.setTextColor(R.id.tv_tip, mContext.getResources().getColor(R.color.btn_yellow));
        } else {
            helper.setBackgroundColor(R.id.layout_root, mContext.getResources().getColor(R.color.white));
            helper.setTextColor(R.id.tv_virtual_money, mContext.getResources().getColor(R.color.btn_red));
            helper.setTextColor(R.id.tv_money, mContext.getResources().getColor(R.color.text_black));
            helper.setTextColor(R.id.tv_tip, mContext.getResources().getColor(R.color.text_black));
        }
    }

    public void setSelPos(int selPos) {
        mSelPos = selPos;
    }
}
